home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
clang
/
c_text.zip
/
P_TIME.C
< prev
next >
Wrap
Text File
|
1987-06-23
|
1KB
|
64 lines
#include <time.h>
#include <math.h>
#include <stdlib.h>
#include <dos.h>
p_time(j_time)
char *j_time;
{
union REGS inreg,outreg;
static char am_pm[] = " a.m.";
char *p1,temp[20];
int rad = 10,one;
inreg.h.ah = 44;
int86(0x21,&inreg,&outreg);
if(outreg.h.ch > 11)
{
outreg.h.ch = outreg.h.ch % 12;
if (outreg.h.ch == 0) outreg.h.ch = 12;
am_pm[1] = 'p';
}
if(outreg.h.ch < 10) one = 1; else one = 0;
p1 = itoa(outreg.h.ch,temp,rad);
if (one == 0)
{
j_time[0] = p1[0];
j_time[1] = p1[1];
}
else
{
j_time[0] = '0';
j_time[1] = p1[0];
}
j_time[2] = ':';
if(outreg.h.cl < 10) one = 1; else one = 0;
p1 = itoa(outreg.h.cl,temp,rad);
if (one == 0)
{
j_time[3] = p1[0];
j_time[4] = p1[1];
}
else
{
j_time[3] = '0';
j_time[4] = p1[0];
}
j_time[5] = ':';
if(outreg.h.dh < 10) one = 1; else one = 0;
p1 = itoa(outreg.h.dh,temp,rad);
if (one == 0)
{
j_time[6] = p1[0];
j_time[7] = p1[1];
}
else
{
j_time[6] = '0';
j_time[7] = p1[0];
}
j_time[8] = '\0';
strcat(j_time,am_pm);
}